<template>
	<view>
		<view class="my-catalog">
			<view class="my-catalog-bar">
				<view class="my-catalog-bar-title">
					我的频道<text class="my-catalog-bar-tip">点击进入频道</text>
				</view>
				
				<view class="my-catalog-bar-button">
					<button type="default" size="mini" @click="catalogEdit">{{buttonText}}</button>
				</view>
		    </view>
			<view class="my-catalog-flag">
				<view class="my-catalog-item active">推荐</view>
				<block v-for="item in catalogs" :key="item.id">
				   <view class="my-catalog-item" :class="{mycatalogitemedit:mycatalogitemedit}" v-if="item.flag==true" >{{item.name}}
				    <uni-icons v-if="unicons" :class="{unicons:unicons}" type="clear" size="20" color="#C0C0C0" @click="catalogDelete(item.id)"></uni-icons>  
				   </view>
				</block>
			</view>
			
		</view>
		<view class="catalog-recommend">
			<view class="catalog-recommend-bar">
				<view class="catalog-recommend-bar-title">
					推荐频道<text class="catalog-recommend-bar-tip">点击进入频道</text>
				</view>
			</view>
			<view class="catalog-recommend-flag">
				<block v-for="item in catalogs" :key="item.id">
				 <view class="catalog-recommend-item" v-if="item.flag==false" @click="catalogAdd(item.id)">+{{item.name}}
				 
				 </view>
			    </block>
			</view>
			
		</view>
		
	</view>
</template>

<script>
	import {uniIcons} from '@dcloudio/uni-ui' //引入组件
	export default {
		data() {
			return {
				catalogs:[
					{id:1,name:'视频',flag:true},
					{id:2,name:'热点',flag:true},
					{id:3,name:'两会',flag:true},
					{id:4,name:'泉州',flag:false},
					{id:5,name:'小说',flag:true},
					{id:6,name:'娱乐',flag:true},
					{id:7,name:'图片',flag:false},
					{id:8,name:'懂车帝',flag:true},
					{id:9,name:'体育',flag:true},
					{id:10,name:'财经',flag:true},
					{id:11,name:'上课',flag:true},
					{id:12,name:'房产',flag:true},
					{id:13,name:'国际',flag:false},
					{id:14,name:'健康',flag:true},
					{id:15,name:'漫画',flag:false},
					{id:16,name:'精品课',flag:true},
					{id:17,name:'影视',flag:true},
					{id:18,name:'生活',flag:true},
					{id:19,name:'游戏',flag:true},
					{id:20,name:'音乐',flag:true},
					{id:21,name:'搞笑',flag:true},
					{id:22,name:'数码',flag:false},
					{id:23,name:'手机',flag:false},
					{id:24,name:'NBA',flag:true},
					{id:25,name:'星座',flag:false},
					{id:26,name:'情感',flag:false},
					{id:27,name:'股票',flag:true}
				],
				unicons:false,
				mycatalogitemedit:false,
				buttonText:'编辑'
			}
		},
		components:{
			uniIcons
		},
		onLoad(options){
			//获取参数
			
			console.log(options)
		},
		methods: {
			catalogEdit(){
				this.$data.unicons==false? this.$data.unicons=true  :this.$data.unicons=false;
				this.$data.mycatalogitemedit==false?this.$data.mycatalogitemedit=true :this.$data.mycatalogitemedit=false;
				this.$data.unicons==false ?this.$data.buttonText='编辑':this.$data.buttonText='完成'
			},
			catalogDelete(id){
				console.log(id)
			},
			catalogAdd(id){
				
				console.log(id)
			}
		}
	}
</script>

<style>
.my-catalog-bar,.catalog-recommend-bar{
	display: flex;
	/* 水平放置默认  row
	   垂直 culoum
	 */
	flex-direction: row;
	justify-content: space-between;
}
.my-catalog-flag{
	display: flex;
	justify-content: space-around;
	flex-wrap: wrap;
}
.active{
	background-color: #ededed;
	color: red;
}
.my-catalog-bar-title,.catalog-recommend-bar-title{
	font-size: 36rpx;
	padding-left: 20rpx;
}
.my-catalog-bar-tip,.catalog-recommend-bar-tip{
	font-size: 24rpx;
	padding-left: 20rpx;
	color: #C8C7CC;
}
.my-catalog-item,.catalog-recommend-item{
	display: inline-block;
	width: 160rpx;
	text-align: center;
	height: 100rpx;
	/* border: 1rpx solid #C8C7CC; */
	line-height: 100rpx;
	box-sizing:border-box;
	margin-top: 10rpx;
	border-radius: 5rpx;
	font-size: 28rpx;
}
.mycatalogitemedit{
	background-color: #ededed;
	position: relative;
}
.unicons{
	position: absolute;
	top: -40rpx;
	right: -10rpx;
}
.catalog-recommend{
	margin-top: 20rpx;
}
</style>
